(function(){
	var _wind = window, _map, _op = new Object, _pnt = new Array;
	var _xobj = [
		function () { return new XMLHttpRequest() },
		function () { return new ActiveXObject("Msxml2.XMLHTTP") },
		function () { return new ActiveXObject("Microsoft.XMLHTTP") }
	];
	_wind.gmap3util = {
		initialize : function (id, option) {
			_map = new google.maps.Map(_wind.document.getElementById(id), _op = option);
		},
		requestUri : function (uri, call) {
			var request = this.requestHttp(_xobj.length);
			if (!request) return false;
			request.onreadystatechange = function () {
				if (request.readyState == 4 && request.status == 200) {
					call(request.responseXML, _map);
					request.onreadystatechange = function(){};
				}
			}
			try {
				request.open("GET", uri, true);
				if (!_op.cache) request.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT");
				request.send(null);
				return true;
			} catch (e) { return false; }
		},
		requestHttp : function (len) {
			for (var i = 0; i < len; i++){
				try {
					return _xobj[i]();
				} catch (e) { continue; }
			}
		},
		addMarker : function (point, option) {
			if (!_pnt.mrk) _pnt.mrk = new Array;
			point._op = option || [] ;
			_pnt.mrk.push(point);
		},
		addPolyline : function (point) {
			if (!_pnt.lne) _pnt.lne = new Array;
			_pnt.lne.push(point);
		},
		polyline : function (call) {
			call(_pnt.lne);
		},
		clearInfoWindows : function (key) {
			for (var i = 0; i < _pnt.mrk.length; i++) _pnt.mrk[i]._op[key].close(_map, _pnt.mrk[i]);
		}
	};
	google.maps.event.addDomListener(window, 'unload', function () {
		for (var i = 0; i < _pnt.mrk.length; i++) {
			google.maps.event.clearInstanceListeners(_pnt.mrk[i]);
			_pnt.mrk = [];
		}
	});
})();